package xgrammar;

import org.w3c.xqparser.SimpleNode;
import org.w3c.xqparser.XParserVisitor;

public class vxpPrintTable implements XParserVisitor
{
    public Object visit(SimpleNode sn, Object o)
    {
        Integer a=(Integer)o;
        String value=sn.getValue();

        /* Ignore the START node */
        if (sn.toString().equals("START"))
        {
            sn.childrenAccept(this, o);
            return o;
        }

        if ((value!=null) && (value.length()>0))
            System.out.print(a.toString()+","+sn.toString()+","+value.toString()+"\n");
        else
            System.out.print(a.toString()+","+sn.toString()+"\n");
        
        sn.childrenAccept(this, a+1);

        return o;
    }
}
